#include <cstdio>

#define MAX_NUMBERS 2000


int prime (size_t pos)
{
	static int prime_list[MAX_NUMBERS] = {2,3};
	bool prime_not_found;

	int &p = prime_list[pos];
	if (p)
		return p;

	p = prime(pos-1) + 2;
	prime_not_found = true;
	while (prime_not_found)
	{
		prime_not_found = false;
		for (int *pp = prime_list; pp < &p; ++pp)
		{
			if (p % *pp == 0)
			{
				prime_not_found = true;
				p += 2;
				break;
			}
		}
	}

	return p;
}


inline bool is_prime (int n)
{
	size_t i;
	int p;

	for (i = 0, p = prime(0); p <= n / p; ++i, p = prime(i))
	{
		if (n % p == 0)
		{
			return p == n;
		}
	}
	return true;
}


inline int letter_value (int c)
{
	const int
		a = 'a' - 1,
		A = 'A' - 27;
	if (c >= 'a')
		return c - a;
	return c - A;
}


inline int input_value (int &c)
{
	int r = 0;
	while (c = getchar (), c != '\n' && c != EOF)
		r += letter_value (c);//, fprintf(stderr, "\tc: %c\tvalue: %d\n", c, letter_value(c));
	//fprintf(stderr, "\t\tr:     %d\n", r);
	return r;
}


int main ()
{
	int c, n;

	do
	{
		n = input_value (c);
		if (n == 0)
			break;
		puts (is_prime (n) || n == 1 ? "It is a prime word." : "It is not a prime word.");
	}
	while (c != EOF);

	return 0;
}